package cn.lzy.profile;

import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

/**
 * @Description xml配置测试类
 * @Author lzy
 * @Date 2023/11/29 15:48
 * @Version
 **/
public class Test02XmlDemo {

    public static void main(String[] args) {
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext();
        ConfigurableEnvironment environment = ctx.getEnvironment();
        environment.setActiveProfiles("dev");
        ctx.setConfigLocation("beans.xml");
        ctx.refresh();
        DataSource ds = ctx.getBean(DataSource.class);
        System.out.println("ds = " + ds);
    }
}
